package com.wx.mapper;

import cn.hutool.core.date.DateTime;
import com.wx.common.MyMapper;
import com.wx.domain.dto.DayReportQueryParam;
import com.wx.domain.dto.SysPatientDto;
import com.wx.domain.vo.FollowStatistics;
import com.wx.domain.vo.NewJoinGroupStatistics;
import com.wx.domain.vo.PatientVo;
import com.wx.domain.vo.PrescriptionStatisticsVo;
import com.wx.entity.SysPatient;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Optional;

/**
 * <p>Title:      SysPatientController. </p>
 * <p>Description  </p>
 * <p>Copyright: Copyright (c) 2016</p>
 * <p>Company:    医百科技有限公司 </p>
 *
 * @author         yangwensheng@100doc.com.cn
 * @since      2021-03-03 11:36:07
 */
@Mapper
@Component
public interface SysPatientMapper extends MyMapper<SysPatient> {

    Optional<SysPatient> selectByKeyOptional(Object key);

    List<PatientVo> listPage(@Param("param") SysPatientDto sysPatient);

    List<SysPatient> selectByHospitalIds(@Param("hospitalIds") List<String> hospitalIds, @Param("param") SysPatient sysPatient);

    SysPatient getPatientInfoByOpenId(String openId);

    SysPatient getPatientInfoById(String patientId);

    List<SysPatient> selectByHospitalIdsAndDateRange(@Param("hospitalIds") List<String> hospitalIds, @Param("prescription")  Integer prescription,
                                                     @Param("startDate") DateTime startDate,  @Param("endDate") DateTime endDate);
    SysPatient selectByPhone(String mobile);

    List<PrescriptionStatisticsVo> exportPrescriptionStatistics(DayReportQueryParam dayReportQueryParam);

    List<NewJoinGroupStatistics> exportNewJoinGroup(DayReportQueryParam dayReportQueryParam);

    List<FollowStatistics> selectAllNurse();

    void batchUpdateNurseId(@Param("patientIds") List<String> patientIds, @Param("nurseId") String nurseId);

    List<SysPatient> selectByIds(@Param("patientIds") List<String> patientIds);
}
